package com.bt.lms.ui.page.sys.style.action.btn;

import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;

/**
 * 鼠标按下事件
 */
public class AddBtnPressedAction implements EventHandler<MouseEvent> {

    /**
     * 按钮
     */
    private final Button button;


    /**
     * 构建事件
     * @param button 要变化的按钮
     */
    public AddBtnPressedAction(Button button){
        this.button = button;
    }

    /**
     * 事件实现
     *  颜色改变
     * @param event the event which occurred
     */
    @Override
    public void handle(MouseEvent event) {

        //背景色
        Color color = Color.rgb(28,139,173);
        Color toColor = Color.rgb(33,162,201);
        BtnStyle.addBtnBackground(button,color,toColor);

        //字体颜色
        Color rgb = Color.rgb(23,100,123);
        button.setTextFill(rgb);

    }
}
